#!/bin/bash

# Clean up previous builds
rm -rf dist

# Clean up compiled files in src (if any)
find src -type f \( -name "*.js" -o -name "*.d.ts" -o -name "*.js.map" \) -delete

# Rebuild the project
tsc -b tsconfig.json

echo "Project cleaned and rebuilt successfully. All output is in dist/"

# Run compatibility engine cleanup
npm run clean:engine